//
//  GSY_Notification.m
//  工厂模式
//
//  Created by Song on 2018/5/20.
//  Copyright © 2018年 Song. All rights reserved.
//

#import "GSY_Notification.h"

@implementation GSY_Notification

// 添加通知 flag：标签
+(void)addGSYObserver:(NSObject *)observer selector:(SEL)selector flag:(NSString *)flag {
    [[NSNotificationCenter defaultCenter] addObserver:observer selector:selector name:flag object:nil];
}

// 发送消息，根据flag标签找到对应的对象
+(void)sendGSYMessage:(id)message toFlag:(NSString *)flag {
    [[NSNotificationCenter defaultCenter] postNotificationName:flag object:nil userInfo:message];
}

// 移除通知
+(void)removeGSYObserver:(NSObject *)observer flag:(NSString *)flag {
    [[NSNotificationCenter defaultCenter] removeObserver:observer name:flag object:nil];
}

@end
